{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#time函数\n",
    "import time\n",
    "print(time.time())#1587199999.9999999 时间戳\n",
    "print(time.localtime())#time.struct_time(tm_year=2020, tm_mon=4, tm_mday=17, tm_hour=10, tm_min=59, tm_sec=59, tm_wday=4, tm_yday=107, tm_isdst=0)\n",
    "print(time.localtime().tm_year)#2020\n",
    "print(time.strftime(\"%Y-%m-%d %H:%M:%S\",time.localtime()))#2020-04-17 11:00:00\n",
    "print(time.strftime(\"%Y-%m-%d %H:%M:%S\",time.localtime(1587199999)))#2020-04-17 11:00:00\n",
    "print(time.asctime()) #Wed Apr 17 11:01:01 2020\n",
    "#log日志\n",
    "import logging\n",
    "logging.basicConfig(level=logging.INFO,format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')#日志级别\n",
    "logging.info(\"info\")#info\n",
    "logging.debug(\"debug\")#debug\n",
    "logging.warning(\"warning\")#warning\n",
    "logging.error(\"error\")#error\n",
    "logging.critical(\"critical\")#critical\n",
    "#logging.basicConfig(filename='test.log',level=logging.INFO,format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')#日志级别\n",
    "#random随机数\n",
    "import random\n",
    "print(random.random())#0.000000-1.000000\n",
    "print(random.randint(1,10))#1-10\n",
    "print(random.choice([1,2,3,4,5]))#1-5随机\n",
    "print(random.sample([1,2,3,4,5],3))#1-5随机3个\n"
   ]
  }
 ],
 "metadata": {
  "language_info": {
   "name": "python"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
